package com.liuhaoqi.raletiveblog.mapper;

import com.liuhaoqi.raletiveblog.entity.Comment;
import com.liuhaoqi.raletiveblog.entity.dto.CommentDto;
import com.liuhaoqi.raletiveblog.result.business.PageResult.CommentMangPageResult;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface CommentMapper {
    int getCommentsnum2();
    int getCommentsnum1();
    List<CommentMangPageResult> getCommentsMangTest(int start,int end,int pagesize);
    int updateCommentByCommentId(Comment comment);
    int deleteCommentByCommentId(Long commentId);
    List<CommentMangPageResult> getCommentsMang(@Param("start") int start,
                                                @Param(("pageSize")) int pageSize);

    int getCommentsMangList();

    //添加一个评论
    int saveComment(Comment comment);

    //查询父级评论
    List<CommentDto> findByParentIdNull(@Param("blogId") Long blogId, @Param("ParentId") Long ParentId);

    //查询一级回复
    List<CommentDto> findByParentIdNotNull(@Param("id") Long id);

    //查询二级以及所有子集回复
    List<CommentDto> findByReplayId(@Param("childId") Long childId);

    int deleteByPrimaryKey(Long commentid);

    int insert(Comment record);

    int insertSelective(Comment record);

    Comment selectByPrimaryKey(Long commentid);

    int updateByPrimaryKeySelective(Comment record);

    int updateByPrimaryKey(Comment record);
}